package com.itdct.onflow.core.extend

import cn.hutool.core.bean.copier.CopyOptions
import com.itdct.onflow.core.entity.IdEntity
import com.itdct.onflow.core.qo.BaseQo
import com.itdct.onflow.core.util.KBeanCopyUtil

/**
 * @author Zhouwx
 * @date 2025/7/22 22:45:43
 * @version 1.0
 * @description
 */
private val copyOptions = CopyOptions.create().ignoreNullValue().setIgnoreProperties("genericInfo", "getGenericInfo")

fun <T : IdEntity> BaseQo.toEntity(entityClass: Class<T>): T {
    val entity = KBeanCopyUtil.copyNewInstance(this, entityClass)
    return entity
}

inline fun <reified T : IdEntity> BaseQo.injectValue(entity: T) {
    KBeanCopyUtil.injectValue(this, entity, true)
}